'use strict';
const Service = require('egg').Service;
class RoleService extends Service {
    async findAllRole() {
        const { app } = this;
        try {
            const list = await app.mysql.select('hsk_role')
            return { list };
          } catch (error) {
            console.log(error);
            return null;
          }
    }

    async saveEditRole() {
        const { app } = this;
        const { id, name, pages } = this.ctx.request.body;
        const result = await app.mysql.update('hsk_role', { name, pages }, { where: { id } });
        const updateSuccess = result.affectedRows === 1;
        return updateSuccess;
    }

}
module.exports = RoleService;
